<?php

defined('PHPFOX') or exit('NO DICE!');

class Pages_Component_Block_AddMember extends Phpfox_Component
{
    public function process()
    {
    	$mId = $this->request()->getInt('req2');
		if (!($aPage = Phpfox::getService('pages')->getForView($mId)))
		{
			return Phpfox_Error::display(Phpfox::getPhrase('pages.the_page_you_are_looking_for_cannot_be_found'));
		}
    	
		$aListFriends = Phpfox::getService("pages")->getCurrentInvitesUser($aPage['page_id']);
		
		
		$sCond = 'friend.user_id='.Phpfox::getUserId().' and u.profile_page_id=0 ';
		if(trim($aListFriends)!="")
		{
			$sCond.= 'and friend.friend_user_id not in ('.$aListFriends.')';
		}
		list($iCnt,$aFriends) = Phpfox::getService("friend")->get($sCond,null,1,8);
		
        $this->template()->assign(array(
            'sHeader' => 'Add people to group',
            'aFriends' => $aFriends,
            'page_id' => $aPage['page_id'],
            'iCnt' => $iCnt,	
            'core_path' => Phpfox::getParam("core.path"),	
        ));
        return 'block';
    }
}

?>